Skip to content

ENT-13277: Adjusted detection of systemd in package scriptlets to handle more valid states#1989

Merged
craigcomstock merged 1 commit intocfengine:masterfrom
craigcomstock:ENT-13277/master
Oct 25, 2025
Merged

ENT-13277: Adjusted detection of systemd in package scriptlets to handle more valid states#1989
craigcomstock merged 1 commit intocfengine:masterfrom
craigcomstock:ENT-13277/master

Conversation

@craigcomstock
Copy link
Copy Markdown
Contributor

In the case where a package is installed but not bootstrapped several of the components: cf-execd, cf-monitord, cf-serverd will not be able to start due to lack of ${sys.inputs}/promises.cf.
This will cause the systemctl is-system-running command to return degraded and a non-zero exit code.

Previously this would cause the cfengine3 service to not be enabled as part of the package install and so on reboots services would not be running.

Ticket: ENT-13277
Changelog: title

@craigcomstock craigcomstock marked this pull request as draft October 17, 2025 19:59
@craigcomstock
Copy link
Copy Markdown
Contributor Author

try centos-7 only jenkins run: Build Status

Comment thread packaging/common/cfengine-hub/postinstall.sh Outdated
@craigcomstock
Copy link
Copy Markdown
Contributor Author

@cf-bottom jenkins please with exotics

@cf-bottom
Copy link
Copy Markdown

@craigcomstock
Copy link
Copy Markdown
Contributor Author

need to skip acceptance tests as hpux and aix may have flakes there right now. rebuild: Build Status

@craigcomstock craigcomstock marked this pull request as ready for review October 21, 2025 03:38
@craigcomstock
Copy link
Copy Markdown
Contributor Author

craigcomstock commented Oct 21, 2025

beautiful green! will manually test/inspect.

Copy link
Copy Markdown
Member

@nickanderson nickanderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so use systemd if systemctl exists and if systemctl is-system-running returns a non empty string that is not offline or unknown.

@craigcomstock
Copy link
Copy Markdown
Contributor Author

craigcomstock commented Oct 21, 2025

I will double check the non systemd container case again with the latest (mostly) green build: Build Status (only selenium tests failed but I suspect that is due to not building the right platform for those tests)

@craigcomstock
Copy link
Copy Markdown
Contributor Author

little snag. In a debian container with systemd installed and systemctl is-system-running reporting offline I still get some errors installing:

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to system scope bus via local transport: Host is down
dpkg: error processing package cfengine-nova-hub (--configure):
 installed cfengine-nova-hub package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 cfengine-nova-hub
Error: Sub-process /usr/bin/dpkg returned an error code (1)

and looking at /var/log/CFEngine-Install.log I see it quit on

+ cf_console platform_service cfengine3 stop

So it seems platform_service needs work. Will do.

@craigcomstock
Copy link
Copy Markdown
Contributor Author

okee, try with my refactor with exotics but skipping acceptance tests that are flaky on exotics: Build Status

@craigcomstock
Copy link
Copy Markdown
Contributor Author

Build Status

…lid states

In the case where a package is installed but not bootstrapped several of the components: cf-execd, cf-monitord, cf-serverd will not be able to start due to lack of ${sys.inputs}/promises.cf.
This will cause the `systemctl is-system-running` command to return `degraded` and a non-zero exit code.

Previously this would cause the cfengine3 service to not be enabled as part of the package install and so on reboots services would not be running.

Ticket: ENT-13277
Changelog: title
@craigcomstock
Copy link
Copy Markdown
Contributor Author

Build Status

@craigcomstock
Copy link
Copy Markdown
Contributor Author

I had to refactor a bit as the script-common.sh wasn't so "common" aka the (rpm|deb)-script-common.sh scripts relied on bits inside there but script-common.sh relied on bits inside of them so I created a new script: script-header.sh which comes first and contains the use_systemd function to use in many places.

@craigcomstock craigcomstock changed the title Adjusted detection of systemd in package scriptlets to handle more valid states ENT-13277: Adjusted detection of systemd in package scriptlets to handle more valid states Oct 24, 2025
@craigcomstock craigcomstock merged commit bf2bcd9 into cfengine:master Oct 25, 2025
29 of 31 checks passed
@craigcomstock craigcomstock deleted the ENT-13277/master branch October 25, 2025 04:01
@craigcomstock
Copy link
Copy Markdown
Contributor Author

craigcomstock commented Apr 22, 2026

this was merged to master before 3.27.0 so only picked to 3.24.x: #2192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants